/*
 *SRM 208 Div Prob 1
 */

import java.util.*;
import java.util.regex.*;
import java.text.*;
import java.math.*;


public class TallPeople
{

    public int[] getPeople(String[] people)
    {
	int r = people.length;
	String[] test = people[0].split ("\\s+");
	int c = test.length;
	int[][] h = new int[r][c];
	for (int i = 0; i < r; ++i) {
	    test = people[i].split ("\\s+");
	    for (int j = 0; j < c; ++j)
		h[i][j] = Integer.parseInt (test[j]);
	    
	}
	int[] row = new int[r], col = new int[c];
	int[] ans = new int[] {Integer.MIN_VALUE, Integer.MAX_VALUE};
	for (int i = 0; i < r; ++i) {
	    row[i] = h[i][0];
	    for (int j = 1; j < c; ++j)
		row[i] = Math.min (row[i], h[i][j]);
	    ans[0] = Math.max (ans[0], row[i]);
	}
	
	
	for (int j = 0; j < c; ++j) {
	    col[j] = h[0][j];
	    for (int i = 1; i < r; ++i)
		col[j] = Math.max (col[j], h[i][j]);
	    ans[1] = Math.min (ans[1], col[j]);
	}
	return ans;
	
    }
    
    <%:testing-code%>
}
//Powered by KawigiEdit 2.1.4 (beta) modified by pivanof!